home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FM Towns: Free Software Collection 7
/
FM Towns Free Software Collection 7.iso
/
t_os
/
gpen32k
/
source.exe
/
LIB
/
OSRC
/
F12D.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-04
|
1KB
|
66 lines
/*
拡張ライブラリIの12ドットフォントの利用
作・おこめ
参考文献 : Oh! FM TOWNS 春の特別号(1993-3)
*/
#include <EGB.H>
#include <FNT.H>
#include <sidework.h>
#include <Normlib.h>
#define iskanji(c) ((0x81 <= c && c <= 0x9f) || (0xe0 <= c && c <= 0xfc))
unsigned short mma_allocSeg(char *para);
void mma_freeSeg(unsigned short seg);
extern char work[];
void font12(int x, int y, char *n, int c)
{
char pa[64];
unsigned short fseg;
unsigned int adr, i, h, l;
y-=11;
fseg = mma_allocSeg("FONT");
EGB_color( work, 0, c);
while(*n != 0)
{
if (iskanji(*n))
{
i = FNT_sjisToJis((*n << 8) + *(n+1));
if (i > 0x4fff)
{
WORD(pa)=WORD(n);
pa[2]=0;
symbol(x,y+11, pa, 12, c);
x+=12;
i = 0;
} else {
h = i >> 8;
l = i & 0xff;
adr = ((h-0x21)*94+l-0x21)*24+0xC00;
i = 11;
}
n+=2;
} else {
adr = *n * 12;
n++;
i = 5;
}
if (i!=0)
{
DWORD(pa) = (int)adr;
WORD(pa+4) = fseg;
WORD(pa+6) = x;
WORD(pa+8) = y;
WORD(pa+10) = x+i;
WORD(pa+12) = y+11;
EGB_putBlockColor(work, 0, pa);
x+= i+1;
}
}
mma_freeSeg(fseg);
}